#define _CRT_SECURE_NO_WARNINGS 1
#include"string.h"
void Test1()
{
	lsx::string str("asfdgnjh");
	lsx::string str2 = str;
}
void Test2()
{
	lsx::string s("awfasdgfhgfxfvgdf");
	for (auto a : s)
	{
		cout << a;
	}
}
void Test3()
{
	lsx::string s("the world");
	s += ' ';
	s += 'a';
	const char wa = 's';
	s.push_back(wa);
	for (auto a : s)
	{
		cout << a;
	}
}
void Test4()
{
	lsx::string s1 = "qwdee";
	lsx::string s2 = " 23qwdee";
	s1 += s2;
	for (auto a : s1)
	{
		cout << a;
	}
}
void Test5()
{
	lsx::string s1 = "awdfgfdhtthfhfdss";
	lsx::string s2 = "hello world";
	s1.swap(s2);
	cout << s1.size() << endl;
	cout << s1.capacity() << endl;
	cout << s1.c_str() << endl;
}
void Test6()
{
	const lsx::string s = "hello world";
	//cout << s[6] << endl;
	string s1 = "";
	cout << s1.empty() << endl;
	lsx::string s2;
	cout << s.empty() << endl;
	cout << s2.empty() << endl;
}
void Test7()
{
	lsx::string s = "the world";
	s.resize(5);
	s.resize(10, 'x');
	s.resize(15);
	string s1 = "12";
	s.resize(6);
}
void Test8()
{
	lsx::string s1 = "abcdefg";
	lsx::string s2 = "abcdeff";
	lsx::string s3 = "abcdefg";
	lsx::string s4 = "abcdefh";
	lsx::string s5 = "abcdefga";
	lsx::string s6 = "abc";
	cout << (s1 > s2) << (s1 < s2) << (s1 >= s2) << (s1 <= s2) << (s1 == s2) << (s1 != s2) << endl;
	cout << (s1 > s3) << (s1 < s3) << (s1 >= s3) << (s1 <= s3) << (s1 == s3) << (s1 != s3) << endl;
	cout << (s1 > s4) << (s1 < s4) << (s1 >= s4) << (s1 <= s4) << (s1 == s4) << (s1 != s4) << endl;
	cout << (s1 > s5) << (s1 < s5) << (s1 >= s5) << (s1 <= s5) << (s1 == s5) << (s1 != s5) << endl;
	cout << (s1 > s6) << (s1 < s6) << (s1 >= s6) << (s1 <= s6) << (s1 == s6) << (s1 != s6) << endl;
	
}
void Test9()
{
	lsx::string s1 = "to fly in the sky !";
	size_t a = s1.find('f');
	cout << s1[a] << endl;
	a = s1.find('a');
	cout << a << endl;
    a = s1.find('t',5);
	cout << s1[a] << endl;
	a = s1.find("in");
	cout << s1[a] << endl;
	a = s1.find("in", 8);
	cout << a << endl;
	a = s1.find("world");
	cout << a << endl;
}
void Test10()
{
	lsx::string s1 = "the world";
	s1.insert(s1.size(), " is");
	s1.insert(4, " hello ");
	s1.insert(0, "all ");
}
void Test11()
{
	lsx::string s1 = "abcdef";
	s1.erase(2);
}
void Test12()
{
	string s1("asd");
}
void Test13()
{
	lsx::string s1;
	s1.insert(0,"sad");
	s1.push_back('x');
	s1.push_back('y');
	s1.push_back('z');
	s1.push_back('x');
	s1.push_back('y');
	s1.push_back('z');
	s1.push_back('x');
	s1.push_back('y');
	s1.push_back('z');
	s1.push_back('x');
	s1.push_back('y');
	s1.push_back('z');
	s1.push_back('x');
	s1.push_back('y');
	s1.push_back('z');
	cout << s1 << endl;
}
void Test14()
{
	lsx::string s1;
	s1.append( "Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
	cout << s1 << endl;
	s1.append("Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
	cout << s1 << endl;
	s1.insert(22, "Ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc");
	cout << s1 << endl;

}
void Test15()
{
	lsx::string s1("sadsf");
	s1 += "asfs";
	s1.push_back('a');
	s1.push_back('a');
	cout << s1.size() << "  " << s1.capacity() << endl;
	lsx::string s2(s1);
	cout << s2.size() << "  " << s2.capacity() << endl;
}
void Test16()
{
	string s1("sadsf");
	s1 += "asfs";
	s1.push_back('a');
	s1.push_back('a');
	//s1.reserve(100);
	cout << s1.size() << "  " << s1.capacity() << endl;
	string s2(s1);
	cout << s2.size() << "  " << s2.capacity() << endl;
}
void Test17()
{
	lsx::string s1("sdf");
	s1.reserve(1000);
	cout << s1.size() << "  " << s1.capacity() << endl;
	lsx::string s2(s1);
	cout << s2.size() << "  " << s2.capacity() << endl;
	s2.push_back('c');
	s2.push_back('c');
	s2.push_back('c');
	cout << s2;
}
void Test18()
{
	string s("abcdefghijklmn");
	cout << s.substr() << endl;
}
int main()
{
	Test18();
	return 0;
}